#!/usr/bin/env bash
dt="`date -d "$d  0 days ago "  "+%Y-%m-%d"`"
mysql -ureadonly -preadonly123 -h192.168.0.49<<EOF
use jiayou;
select from_unixtime(created,'%Y-%m-%d')as daya,sum(discount_amount)as suma
,SUM(case when coupon_statue = 3 then discount_amount else 0 end) sumb
from coupon_info
where from_unixtime(created,'%Y-%m-%d')='2018-09-01'
group by from_unixtime(created,'%Y-%m-%d');
EOF